<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>lowpass2</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="loscilx.html" title="loscilx" />
    <link rel="next" href="lowres.html" title="lowres" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">lowpass2</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="loscilx.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="lowres.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="lowpass2"></a>
      <div class="titlepage"></div>
      <a id="IndexLowpass2" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">lowpass2</span>
        </h2>
        <p>lowpass2 — 
      A resonant lowpass filter.
          </p>
      </div>
      <div class="refsect1">
        <a id="idp120952240"></a>
        <h2>Description</h2>
        <p>
      Implementation of a resonant second-order lowpass filter.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp120953616"></a>
        <h2>Syntax</h2>
        <pre class="synopsis">ares <span class="command"><strong>lowpass2</strong></span> asig, kcf, kq [, iskip]</pre>
      </div>
      <div class="refsect1">
        <a id="idp120955824"></a>
        <h2>Initialization</h2>
        <p>
      <span class="emphasis"><em>iskip</em></span> -- initial disposition of internal data space. A zero value will clear the space; a non-zero value will allow previous information to remain. The default value is 0.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp120957808"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>asig</em></span> -- input signal to be filtered
    </p>
        <p>
      <span class="emphasis"><em>kcf</em></span> -- cutoff or resonant frequency of the filter, measured in Hz
    </p>
        <p>
      <span class="emphasis"><em>kq</em></span> -- Q of the filter, defined, for bandpass filters, as bandwidth/cutoff. <span class="emphasis"><em>kq</em></span> should be between 1 and 500
    </p>
        <p>
      <span class="emphasis"><em>lowpass2</em></span> is a second order IIR lowpass filter, with k-rate controls for cutoff frequency (<span class="emphasis"><em>kcf</em></span>) and Q (<span class="emphasis"><em>kq</em></span>). As <span class="emphasis"><em>kq</em></span> is increased, a resonant peak forms around the cutoff frequency, transforming the lowpass filter response into a response that is similar to a bandpass filter, but with more low frequency energy. This corresponds to an increase in the magnitude and "sharpness" of the resonant peak. For high values of <span class="emphasis"><em>kq</em></span>, a scaling function such as <span class="emphasis"><em>balance</em></span> may be required. In practice, this allows for the simulation of the voltage-controlled filters of analog synthesizers, or for the creation of a pitch of constant amplitude while filtering white noise.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp120965824"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the lowpass2 opcode. It uses the file <a class="ulink" href="examples/lowpass2.csd" target="_top"><em class="citetitle">lowpass2.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp120967600"></a>
          <p class="title">
            <strong>Example 447. Example of the lowpass2 opcode.</strong>
          </p>
          <div class="example-contents">
            <p>See the sections <a class="link" href="UsingRealTime.html" title="Real-Time Audio"><em class="citetitle">Real-time Audio</em></a> and <a class="link" href="CommandFlags.html" title="Csound command line"><em class="citetitle">Command Line Flags</em></a> for more information on using command line flags.</p>
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="comment">; For Non-realtime ouput leave only the line below:</span>
<span class="comment">; -o lowpass2.wav -W ;;; for file output any platform</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="op">/</span><span class="op">*</span> Written by Sean Costello <span class="op">*</span><span class="op">/</span>
<span class="comment">; Orchestra file for resonant filter sweep of a sawtooth-like waveform.</span>
  <span class="ohdr">sr</span> <span class="op">=</span> 44100
  <span class="ohdr">kr</span> <span class="op">=</span> 2205
  <span class="ohdr">ksmps</span> <span class="op">=</span> 20
  <span class="ohdr">nchnls</span> <span class="op">=</span> 1

          <span class="oblock">instr</span> 1

  idur    <span class="op">=</span>          p3
  ifreq   <span class="op">=</span>          p4
  iamp    <span class="op">=</span>          p5 <span class="op">*</span> .5
  iharms  <span class="op">=</span>          (<span class="ohdr">sr</span><span class="op">*</span>.4) <span class="op">/</span> ifreq

<span class="comment">; Sawtooth-like waveform</span>
  asig    <span class="opc">gbuzz</span> 1, ifreq, iharms, 1, .9, 1

<span class="comment">; Envelope to control filter cutoff </span>
  kfreq   <span class="opc">linseg</span> 1, idur <span class="op">*</span> 0.5, 5000, idur <span class="op">*</span> 0.5, 1

  afilt   <span class="opc">lowpass2</span> asig,kfreq, 30

<span class="comment">; Simple amplitude envelope</span>
  kenv    <span class="opc">linseg</span> 0, .1, iamp, idur <span class="op">-</span>.2, iamp, .1, 0 
          <span class="opc">out</span> afilt <span class="op">*</span> kenv

          <span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

/* Written by Sean Costello */
<span class="stamnt">f</span>1 0 8192 9 1 1 .25

<span class="stamnt">i</span>1 0 5 100 1000
<span class="stamnt">i</span>1 5 5 200 1000
<span class="stamnt">e</span>


<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp120971920"></a>
        <h2>Credits</h2>
        <p>
      </p>
        <table border="0" summary="Simple list" class="simplelist">
          <tr>
            <td>Author: Sean Costello</td>
          </tr>
          <tr>
            <td>Seattle, Washington</td>
          </tr>
          <tr>
            <td>August 1999</td>
          </tr>
        </table>
        <p>
    </p>
        <p>New in Csound version 4.0</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="loscilx.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="lowres.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">loscilx </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> lowres</td>
        </tr>
      </table>
    </div>
  </body>
</html>
